// const fs = require('fs')
// const path = require('path')
// const multer = require('koa-multer')

// const formidable = require('formidable')

module.exports = (ctx, next) => {
  // koaBetterBody({fields: 'body'})(ctx, next)
  // next()
  // let storage = multer.diskStorage({
  //   destination: path.resolve('upload'),
  //   filename: (ctx, file, cb) => {
  //     cb(null, file.originalname)
  //   }
  // })
  // let fileFilter = (ctx, file, cb) => {
  //   if (file.originalname.split('.').splice(-1) === 'txt') {
  //     cb(null, false)
  //   } else {
  //     cb(null, true)
  //   }
  // }
  // let upload = multer({storage: storage, fileFilter: fileFilter})
  
  // try {
  //   let form = new formidable.IncomingForm()
  //   form.parse(ctx.request, (err, fields, files) => {
  //     console.log('files:', files)
  //     console.log('fields:', fields)
  //   })
  // } catch(e) {
  //   console.log(e)
  // }
  const data = ctx.request.body
  console.log('data', data)
  ctx.state.data = {}
}